<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    var numSteps = function(s) {
    let num = Number('0b' + s)
    let step = 0
    while(num !== 1){
        if(num % 2 === 0){
            num /= 2
        }else {
            num += 1
        }
        step ++
    }
    return step
};
console.log(numSteps("10"));
  </script>
</body>
</html>